import Vue from 'vue'
import VueRouter from 'vue-router'

import LoginView from "@/views/LoginView";
import MainView from "@/views/MainView";
import ProductView from "@/views/ProductView";
import UserView from "@/views/UserView";
import UploadView from "@/views/UploadView";
import PayView from "@/views/PayView";

Vue.use(VueRouter)
// 路由规则
const routes = [
  // {
  //   path: '/',
  //   component: UploadView
  // },
  // {
  //   path: '/',
  //   component: PayView
  // },
  {
    path: '/',
    name: 'login',
    component: () => import('@/views/LoginView')
  },
  {
    path: '/main',
    name: 'main',
    component: MainView,
    //子页面
    children: [
      {
        path: '/product',
        name: 'product',
        component: ProductView
      },
      {
        path: '/user',
        name: 'user',
        component: UserView
      }
    ]
  },
]

const router = new VueRouter({
  routes
})

export default router
